<script type="text/html" template>
    <link rel="stylesheet" href="{{ layui.setter.base }}/start/layui/css/layui.css">
    <link rel="stylesheet" href="{{ layui.setter.base }}style/css/reset.css">
    <link rel="stylesheet" href="{{ layui.setter.base }}style/css/home/Customized.css">
    <script src="{{ layui.setter.base }}/start/layui/layui.all.js"></script>
</script>
    <div class="customized-alert layui-fluid">
        <div class="layui-alert-title">显示列定制</div>
        <ul class="alert-con layui-containner layui-form" lay-filter="test1">
            <li>
                <input lay-filter="c_all" type="checkbox" name="" title="全选" lay-skin="primary">
            </li>
            <li>
                <input lay-filter="c_one" class="cityId" type="checkbox" value="" title="计划名称" lay-skin="primary">
            </li>
            <li>
                <input lay-filter="c_one" class="cityId" type="checkbox" value="" title="计划编号" lay-skin="primary">
            </li>
            <li>
                <input lay-filter="c_one" class="cityId" type="checkbox" value="" title="计划状态" lay-skin="primary">
            </li>
            <li>
                <input lay-filter="c_one" class="cityId" type="checkbox" value="" title="上次巡检工单" lay-skin="primary">
            </li>
            <li>
                <input lay-filter="c_one" class="cityId" type="checkbox" value="" title="下次巡检时间" lay-skin="primary">
            </li>
            <li>
                <input lay-filter="c_one" class="cityId" type="checkbox" value="" title="计划开始时间" lay-skin="primary">
            </li>
            <li>
                <input lay-filter="c_one" class="cityId" type="checkbox" value="" title="计划结束时间" lay-skin="primary">
            </li>
            <li>
                <input lay-filter="c_one" class="cityId" type="checkbox" value="" title="计划频率" lay-skin="primary">
            </li>
            <li>
                <input lay-filter="c_one" class="cityId" type="checkbox" value="" title="位置范围" lay-skin="primary">
            </li>
            <li>
                <input lay-filter="c_one" class="cityId" type="checkbox" value="" title="总设备数" lay-skin="primary">
            </li>
        </ul>
        <div class="footer layui-alert-btn-containner">
            <button class="
            alert-btn-one layui-btn layui-btn-radius layui-btn-primary">确定</button>
            <button class="
            alert-btn-two
            layui-btn layui-btn-radius layui-btn-primary">取消</button>
        </div>
    </div>
    
    <script>
     ! function() {
            var form = layui.form,
                layer = layui.layer,
                $ = layui.$,
                admin = layui.admin,
                view = layui.view,
                api = layui.api,
                table = layui.table,
                setter = layui.setter,
                laytpl = layui.laytpl,
                utill = layui.utill,
                form = layui.form,
                element = layui.element;
            $('.footer').on('click', 'button', function() {
                var index = parent.layer.getFrameIndex(window.name);
                parent.layer.close(index);
            });
            //全选
            form.on('checkbox(c_all)', function(data) {
                var a = data.elem.checked;
                if (a == true) {
                    $(".cityId").prop("checked", true);
                    form.render('checkbox');
                } else {
                    $(".cityId").prop("checked", false);
                    form.render('checkbox');
                }

            });
            //有一个未选中全选取消选中
            form.on('checkbox(c_one)', function(data) {
                var item = $(".cityId");
                for (var i = 0; i < item.length; i++) {
                    if (item[i].checked == false) {
                        $("input:eq(0)").prop("checked", false);
                        form.render('checkbox');
                        break;
                    }
                }
                //如果都勾选了  勾上全选
                var all = item.length;
                for (var i = 0; i < item.length; i++) {
                    if (item[i].checked == true) {
                        all--;
                    }
                }
                if (all == 0) {
                    $("input:eq(0)").prop("checked", true);
                    form.render('checkbox');
                }
            })


        }();
    </script>